<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'header.php'?>
<style type="text/css">
	
</style>
<div class="page-header">
	<h1>作业列表</h1>
</div>

<div class="col-xs-12">
	<a href="<?=admin_url('contents/homework_edit')?>/<?=$classInfo['id']?>" class="btn btn-primary">
		<i class="ace-icon fa fa-plus"></i> 发布作业
	</a>
	<table id="dynamic-table" class="table table-striped table-bordered table-hover" style="margin-top:10px">
		<thead>
			<tr>
				<th>作业标题</th>
				<th>作业科目</th>
				<th>作业发送班级</th>
				<th>发送时间</th>
				<th>修改时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
</div>

<?php require VIEWPATH. ADMIN_DIR. DIRECTORY_SEPARATOR. 'footer.php'?>
<script type="text/javascript">
	$(function(){

		// 班级表格
		$('#dynamic-table').dt({
			"ajaxUrl": '<?=admin_url('contents/get_homework_list')?>/<?=$classInfo['id']?>',
			"columns": [
	            {"data": "homework_title"},
	            {"data": "lessonName"},
	            {"data": function(ret){
	            	var html = "";
	            	for(var i in ret.classList) html += '<span class="label label-success mr10">'+ ret.classList[i]['class_name'] +'</span>';
	            	return html;
	            }},
	            {"data": "createtime"},
	            {"data": "updatetime"},
	            {"data": function(ret){
	            	var action = '';
	            	action += '<a class="edit-grade green" href="<?=admin_url('contents/homework_edit')?>/<?=$classInfo['id']?>/'+ ret.id +'"><i class="fa fa-edit"></i> 编辑</a>';
	                return action;
	            }},
			]
		});
		
	})
</script>